/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vamprest;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author sav
 */
@Entity
@Table(name = "gpslocation")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Gpslocation.findAll", query = "SELECT g FROM Gpslocation g"),
    @NamedQuery(name = "Gpslocation.findByIdgpslocation", query = "SELECT g FROM Gpslocation g WHERE g.idgpslocation = :idgpslocation"),
    @NamedQuery(name = "Gpslocation.findByLatitude", query = "SELECT g FROM Gpslocation g WHERE g.latitude = :latitude"),
    @NamedQuery(name = "Gpslocation.findByLongitude", query = "SELECT g FROM Gpslocation g WHERE g.longitude = :longitude"),
    @NamedQuery(name = "Gpslocation.findByDegree", query = "SELECT g FROM Gpslocation g WHERE g.degree = :degree"),
    @NamedQuery(name = "Gpslocation.findByMinute", query = "SELECT g FROM Gpslocation g WHERE g.minute = :minute"),
    @NamedQuery(name = "Gpslocation.findBySecond", query = "SELECT g FROM Gpslocation g WHERE g.second = :second")})
public class Gpslocation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "idgpslocation")
    private Integer idgpslocation;
    @Basic(optional = false)
    @NotNull
    @Column(name = "latitude")
    private double latitude;
    @Basic(optional = false)
    @NotNull
    @Column(name = "longitude")
    private double longitude;
    @Basic(optional = true)
    @Column(name = "degree")
    private double degree;
    @Basic(optional = true)
    @Column(name = "minute")
    private double minute;
    @Basic(optional = true)
    @Column(name = "second")
    private double second;
    @OneToMany(mappedBy = "idgpslocation")
    private Collection<Vehiclestatus> vehiclestatusCollection;

    public Gpslocation() {
    }

    public Gpslocation(Integer idgpslocation) {
        this.idgpslocation = idgpslocation;
    }

    public Gpslocation(Integer idgpslocation, double latitude, double longitude, double degree, double minute, double second) {
        this.idgpslocation = idgpslocation;
        this.latitude = latitude;
        this.longitude = longitude;
        this.degree = degree;
        this.minute = minute;
        this.second = second;
    }

    public Integer getIdgpslocation() {
        return idgpslocation;
    }

    public void setIdgpslocation(Integer idgpslocation) {
        this.idgpslocation = idgpslocation;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getDegree() {
        return degree;
    }

    public void setDegree(double degree) {
        this.degree = degree;
    }

    public double getMinute() {
        return minute;
    }

    public void setMinute(double minute) {
        this.minute = minute;
    }

    public double getSecond() {
        return second;
    }

    public void setSecond(double second) {
        this.second = second;
    }

    @XmlTransient
    public Collection<Vehiclestatus> getVehiclestatusCollection() {
        return vehiclestatusCollection;
    }

    public void setVehiclestatusCollection(Collection<Vehiclestatus> vehiclestatusCollection) {
        this.vehiclestatusCollection = vehiclestatusCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idgpslocation != null ? idgpslocation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Gpslocation)) {
            return false;
        }
        Gpslocation other = (Gpslocation) object;
        if ((this.idgpslocation == null && other.idgpslocation != null) || (this.idgpslocation != null && !this.idgpslocation.equals(other.idgpslocation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vamprest.Gpslocation[ idgpslocation=" + idgpslocation + " ]";
    }

}
